<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateMybankFuyouBillRecord extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('mybank_fuyou_bill_record', function (Blueprint $table) {
            $table->id();

            $table->unsignedBigInteger("shopId")->default(0)->comment("门店ID");
            $table->string("mybankMerchantId", 32)->default("")->comment("网商商户号");
            $table->unsignedBigInteger("kfOrderNo")->default(0)->comment("夸父订单号");

            $table->string("fyMerchantId", 36)->default("")->comment("富有商户号");
            $table->string("cardNum", 36)->default("")->comment("卡号");
            $table->string("cardAttr", 36)->default("")->comment("卡属性");
            $table->string("referenceNum", 36)->default("")->comment("参考号");
            $table->string("transactionType", 12)->default("")->comment("交易类型");

            $table->string("terminalNum", 36)->default("")->comment("终端号");
            $table->string("merchantOrderNo", 36)->default("")->comment("商户订单号");
            $table->string("channelOrderNo", 36)->default("")->comment("渠道订单号");
            $table->bigInteger("transactionAmount")->default(0)->comment("交易金额");
            $table->string("transactionStatus", 12)->default("")->comment("交易状态");


            $table->string("transactionStatusDesc", 36)->default("")->comment("交易状态说明");
            $table->unsignedInteger("transactionCompletionTime")->default(0)->comment("交易完成时间");
            $table->string("transactionDate", 12)->default("")->comment("交易日期");
            $table->string("originalTransactionOrderNo", 36)->default("")->comment("原交易订单号");
            $table->bigInteger("transactionFee")->default(0)->comment("交易手续费");

            $table->string("externalOrderNo", 36)->default("")->comment("外部订单号");
            $table->string("transactionCode", 36)->default("")->comment("交易代码");
            $table->string("isPreferentialRate", 36)->default("")->comment("是否优惠费率");
            $table->string("merchantDiscountRate", 36)->default("")->comment("商户扣率");
            $table->string("errorTransactionSign", 36)->default("")->comment("差错交易标识");
            $table->string("remark")->default("")->comment("备注");

            $table->unsignedInteger('createdAt')->default(0)->comment('创建时间');
            $table->unsignedInteger('updatedAt')->default(0)->comment('更新时间');
            $table->tinyInteger("isDeleted")->default(0)->comment("是否删除,0:未删除,1:已删除");

            $table->collation = 'utf8mb4_general_ci';
            $table->comment   = '网商 - 富友账单表';
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('mybank_fuyou_bill_record');
    }
}
